package com.ifinc.common.protocol.i8583.field;

import com.ifinc.common.utils.StringUtils;

/**
 * User: luotao
 * Date: 13-11-15
 * Time: 13:41
 */
public class FieldAsc extends AbstractField{

    public FieldAsc() {
    }

    public FieldAsc(int fieldLen) {
        super(fieldLen);
    }

    public FieldAsc(int fieldLen, boolean joinBitMap) {
        super(fieldLen, joinBitMap);
    }

    @Override
    public byte[] toByte() {
        String str =StringUtils.rightPadWithBytes(srcValue,fieldLen,' ',getEncoding());
        return setResDataInfo(str);
    }

    @Override
    public byte[] toMacByte() {
        return srcBytes;
    }

    @Override
    public String getFieldType() {
        return ASC;
    }

    @Override
    public void verify() {
    }

    @Override
    public int toValue(byte[] data, int index) {
        return 0;
    }
}
